<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp" %>
<%@ include file="/commons/validation.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>缴费设置</title>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript">
var closeVarTmp = null;
function submitFun(closeVar){
	closeVarTmp = closeVar;

	var isPass=$('submitForm').fireEvent("onSubmit");
	if(isPass){
		closeORopenButton();
		var param = Form.serialize('submitForm');
		var url = "${ctx }/system_occupationConfigAction.do?method=editCharge";
		new Ajax.Request(url,{method: 'post',parameters :param ,onSuccess : showResponse});
	}
}

function showResponse(response){
	closeORopenButton();
	ajaxSubmitException(response.responseText);
	if(response.responseText == "true" ){
		if(closeVarTmp){
			closeWinAndRefresh();
		}
		else{
			var iframe = findFrame('main');

			iframe.reloadList('chargeListPage');
			location.reload();
		}
	}
}

function closeWinAndRefresh(){
	 var iframe = findFrame('main');

	 iframe.reloadList('chargeListPage');

	 windowClose();
}

	//关闭或打开按钮事件
function closeORopenButton(){

	//$('window_footer').disabled= !$('window_footer').disabled;
	<c:if test="${occupationChargeItemConfigVO.keyword == null}">
	$('btn1_22').disabled= !$('btn1_22').disabled;
	</c:if>
	$('btn1_42').disabled= !$('btn1_42').disabled;
	$('btn1_32').disabled= !$('btn1_32').disabled;
}

	//交易码说明
	function getDescription(){
		var select = $('businessCodeId').value;
		var url = '${ctx }/system_occupationConfigAction.do?method=getBusinessCodeDescription';
		new Ajax.Request(url,{method: 'post',parameters : {businessCodeId:select} ,onSuccess : function(response){
			if(response.responseText != 'false'){
				$('description').value = response.responseText;
			}
		}});

	}

	function checkState(){
		if($('monthPayYn').checked != true){
			$('payMonthCount').value = '';
		}
	}

	//交易码说明
	function getDescription(isDescription){
		var select = $('businessCodeId').value;
		var url = '${ctx }/system_occupationConfigAction.do?method=getBusinessCodeDescription&isDescription=' + isDescription;
		new Ajax.Request(url,{method: 'post',parameters : {businessCodeId:select} ,onSuccess : function(response){
			if(response.responseText != 'false'){
				if(isDescription)
					$('description').value = response.responseText;
				else
					$('businessCode_Td').innerHTML = response.responseText;

			}
		}});
	}

	function init(){
		<c:if test="${occupationChargeItemConfigVO.businessCodeId != null }">
		getDescription(false);
		</c:if>
	}
</script>
</head>

<body onload="init();">
<form action="" name="submitForm" id="submitForm" method="post"  class="required-validate">
<input type="hidden" name="keyword" id="keyword" value="${occupationChargeItemConfigVO.keyword }" />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"> <span class="window_head_intext">缴费设置</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">

            <tr>
              <td class="aux_intable_td1">交易码：</td>
              <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td id="businessCode_Td">

					<pms:unitedSelect
			     		id="businessCodeId"
			     		name="businessCodeId"
			     		optionLabel="bizCode"
			     		optionValue="keyword"
			     		selectText="请选择..."
			     		dataList="${businessCodeList}"
			     		className="select-one-required"
			     		value="${occupationChargeItemConfigVO.businessCodeId }"
			     		onChange="getDescription(true);"
			     	>
			     	</pms:unitedSelect>
					</td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td class="aux_intable_td1">描 述：</td>
              <td class="aux_intable_td2"><input name="description" id="description" type="text" readonly="readonly" class="inputtext" value="${occupationChargeItemConfigVO.description }" size="16"></td>
            </tr>
			 <tr>
               <td class="aux_intable_td1">收费项目名称：</td>
			   <td class="aux_intable_require">
			   <input name="payItemName" maxlength="20" <c:if test="${occupationChargeItemConfigVO.keyword != null}">readonly="readonly"</c:if>  id="payItemName" type="text" class="inputtext required validate-char" value="${occupationChargeItemConfigVO.payItemName }" size="16">
			   </td>
		      </tr>

			<tr>
              <td class="aux_intable_td1">计费模式：</td>
              <td class="aux_intable_require">
                <select name="payMode" class="select-one-required">

                  <option <c:if test="${occupationChargeItemConfigVO.payMode == null }">selected="selected"</c:if> value="">请选择...</option>
                  <option <c:if test="${occupationChargeItemConfigVO.payMode == '001' }">selected="selected"</c:if> value="001">按固定金额计费</option>
                  <option <c:if test="${occupationChargeItemConfigVO.payMode == '002' }">selected="selected"</c:if> value="002">按建筑面积计费</option>
                </select>
              </td>
            </tr>
			<tr>
			  <td class="aux_intable_td1">收费标准：</td>
			  <td class="aux_intable_require">
			  <input  name="payMoney" id="payMoney"  type="text" class="inputtext required validate-number min-value-1" maxlength="10" value="${occupationChargeItemConfigVO.payMoney }" size="16"></td>
			  </tr>
			<tr>
			  <td class="aux_intable_td1">收费跟进：</td>
			  <td class="aux_intable_td2"><c:if test="${occupationChargeItemConfigVO.payTransferYn == null }"><input checked="checked" name="payTransferYn" type="radio" value="1" >
			    是&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			      <input type="radio" name="payTransferYn" value="0">
		        否</c:if>
		        <c:if test="${occupationChargeItemConfigVO.payTransferYn == '1' }"><input type="radio" checked="checked" name="payTransferYn" value="1">是</c:if>
		        <c:if test="${occupationChargeItemConfigVO.payTransferYn == '0' }"><input type="radio" checked="checked" name="payTransferYn" value="0">否</c:if>
		        </td>
			  </tr>

			<tr>
			  <td class="aux_intable_td1">缴费月数：</td>
			  <td class="aux_intable_td2"><input name="monthPayYn" id="monthPayYn" type="checkbox" <c:if test="${occupationChargeItemConfigVO.monthPayYn == '1' }">checked="checked"</c:if> onClick="judgePerMonth(this);" value="1" >
			    按月缴费&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="display: none;" id="permonth">缴费月数为
		          <input name="payMonthCount" id="payMonthCount" type="text" class="inputtext validate-number  min-value-1" maxlength="3" value="${occupationChargeItemConfigVO.payMonthCount }" size="5">
	            个月</span></td>
			  </tr>
			  <tr>
            <td valign="top"  class="aux_intable_td1">使用状态：</td>
            <td class="aux_intable_td2"><input name="stopYn" <c:if test="${occupationChargeItemConfigVO.stopYn == '1' || occupationChargeItemConfigVO.stopYn == null }">checked="checked"</c:if> type="radio" value="1">
			    在 用&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			      <input type="radio" name="stopYn"  <c:if test="${occupationChargeItemConfigVO.stopYn == '0' }">checked="checked"</c:if> value="0">停 用</td>
          </tr>
        </table>
			<script language="javascript">
			function judgePerMonth(obj){
				if(!obj.checked){
				document.all.item("permonth").style.display = "none";
				document.all.item("payMonthCount").value="";
				 Validation.changeElmValidate("payMonthCount","validate-number  min-value-1");

				}
				if(obj.checked){
				document.all.item("permonth").style.display = "";
				 Validation.changeElmValidate("payMonthCount","required validate-number  min-value-1");
				}
			}
			</script></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
        <c:if test="${occupationChargeItemConfigVO.keyword == null }">
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="javascript:submitFun(false);" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onblur="btn_change(2)"><img src="${ctx}/images/ico_saveandnewfile.gif" alt="" width="14" height="14" border="0" align="absbottom"> 保存并新增</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table>
        </c:if>
        </td>
        <td class="btn_between_space"></td> <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_41"></td>
              <td class="buttonOffMiddle" id="btn1_42" onClick="javascript:submitFun(true);" onMouseOver="btn_change_over(4)" onMouseOut="btn_change_out(4)" onblur="btn_change(4)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom"> 保 存</td>
              <td class="buttonOffRight" id="btn1_43"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onClick="javascript:windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onblur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom"> 取 消</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
</body>
<script type="text/javascript">
judgePerMonth(document.getElementById("monthPayYn"));
</script>
</html>